<?php 
    class Agents extends CI_Model{

        function __construct(){
            parent::__construct();
        }

        function get_school_recode($data_type, $school_id, $commission_status = 'all'){
            $sql = "SELECT sum(price*num) AS price, sum(commission) AS commission FROM {$this->db->dbprefix}o2o_school_order_records WHERE data_type = $data_type AND school_id = '{$school_id}'";
            if($commission_status != 'all'){
                $sql .= " AND commission_status = '{$commission_status}'";
            }
            $result = $this->db->query($sql)->row_array();
            return $result;
        }
    }